package com.example.llademo;

import com.example.llademo.model.dto.ExcelReadResult;
import com.example.llademo.util.LlaExcelUtil;
import com.example.llademo.util.LlaIOUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Date;

@SpringBootApplication
@Slf4j
public class LlaDemoApplication implements ApplicationRunner {

    public static void main(String[] args) {
        SpringApplication.run(LlaDemoApplication.class, args);
    }

    @Autowired
    private LlaIOUtil llaIOUtil;
    @Autowired
    private LlaExcelUtil llaExcelUtil;

    /**
     * 启动写出结果，现在将files/下文件改为了2024年数据
     * @param args
     * @throws Exception
     */
    //fixme springBatch
    @Override
    public void run(ApplicationArguments args) throws Exception {
        //1.读取excel中飞机数据
        ExcelReadResult excelReadResult = llaExcelUtil.simpleReadResult();
        Date takeOffTime = excelReadResult.getTakeOffTime();
        Date landingTime = excelReadResult.getLandingTime();
//        List<ADSPosition> adsList = excelReadResult.getAdsList();
        log.info("takeOffTime:{}",takeOffTime);
        log.info("landingTime:{}",landingTime);
        //2.将卫星1，卫星2数据与飞机数据进行对比查看覆盖率并导出覆盖到飞机的卫星数据1，2到文件
        llaIOUtil.readAndFilterLlaFiles(excelReadResult);
    }
}
